package com.blogsoho.taurus.controller.admin;

import com.blogsoho.taurus.constants.URIMapping;
import com.blogsoho.taurus.vm.ResponseWrapper;
import com.blogsoho.taurus.vo.UserVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by user on 2017/6/15.
 */
@Controller
@RequestMapping(URIMapping.ADMIN)
public class AdminLoginController extends BaseAdminController {

	@GetMapping(URIMapping.ADMIN_LOGIN)
	public String loginView() {
		return "admin/login";
	}

    @GetMapping(URIMapping.ADMIN_REGISTER)
    public String registerView() {
        return "admin/register";
    }

    @PostMapping(URIMapping.ADMIN_REGISTER)
    @ResponseBody
    public ResponseWrapper<?> registerUser(UserVO user) {
        ResponseWrapper<?> response = new ResponseWrapper<>();
        response = userService.addUser(user);
        return response;
    }

}
